package com.apes.framework.jpa.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.NoRepositoryBean;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

@NoRepositoryBean
public interface CustomRepository<T, ID extends Serializable> extends JpaRepository<T, ID>, JpaSpecificationExecutor<T> {

    int exec(String sql);

    int exec(String sql, Map<String, Object> params);

    List findAll(String sql);

    List findAll(String sql, Map<String, Object> params);

    T findOne(ID id);

    void delete(ID id);

    boolean exists(ID id);

    <S extends T> List<S> save(Iterable<S> entities);
}
